// 刷新待办任务数量
export function refreshTaskCount(dispatch) {
    dispatch({
        type: 'global/fetchTaskCount',
        callback: res => {
            // console.log('refreshTaskCount -> res', res);
            const { code, data } = res;
            if (code === 10000) {
                const { toAcceptTaskNum, toAuditTaskNum, toExecuteTaskNum, toScoreTaskNum, toEstimateTaskNum } = data;
                dispatch({
                    type: 'menu/saveMenu',
                    payload: {
                        count: toAcceptTaskNum + toAuditTaskNum + toExecuteTaskNum + toScoreTaskNum + toEstimateTaskNum,
                        path: '/work/task'
                    }
                });
                dispatch({
                    type: 'menu/saveMenu',
                    payload: {
                        count: toAcceptTaskNum + toAuditTaskNum + toExecuteTaskNum + toScoreTaskNum + toEstimateTaskNum,
                        path: '/work/task/mytask'
                    }
                });
            }
        }
    });
}
